package com.sc.servlet.admin.notice;

import com.sc.services.NoticeServices;
import com.sc.services.UserServices;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description: 管理员删除公告信息
 * @author: sc
 * @create: 2023-01-05 22:42
 **/
@WebServlet("/deleteNotice")
public class deleteNoticeServlet extends HttpServlet {

    private NoticeServices noticeServices = new NoticeServices();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String noticeid = request.getParameter("noticeid");
        String res=null;

       noticeServices.deleteNoticeById(Integer.parseInt(noticeid));
        res = "delete_suc";

        response.setContentType("text/json;charset=utf-8");
        response.getWriter().write(res);


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}